import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class CoreAuthService extends BaseService<any> {
  private readonly logger = new Logger(CoreAuthService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getAuthInfo
   * 对应 PHP: CoreAuthService_core::getAuthInfo()
   * 逻辑类型: undefined - undefined
   */
  async getAuthInfo() {
    // 基于PHP真实逻辑: getAuthInfo
    // PHP原文: $auth_info = $this->httpGet('authinfo', ['code' => $this->code, 'secret' => $this->secret, 'product_key' => self::PRODUCT ]);         if(!empty($auth_...
const auth_info = this.httpGet('authinfo', [code: this.code, secret: this.secret, product_key: self.PRODUCT )];
        if(!!auth_info.data)){
            auth_info.data.address_type = true;
            if(auth_info.data.site_address != _SERVER.HTTP_HOST) auth_info.data.address_type = false;
  }
}
